<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title> {% if order.is_card %}卡券 {% endif %}{% if order.is_active %}激活{% endif %}销售订单打印</title>
    <link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="/web/static/src/css/full.css">
    <link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css">
    <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/web/static/src/css/base.css">

    <script language="javascript" src="/lodop/static/src/js/mathlibrary.js"></script>

    <style type="text/css" id="style">
        body{padding: 10px; font-size: 10pt; overflow: auto}
        @media print
        {
            .print-hide {display:none}
        }
        .td_inline {
            display:block;
            overflow:hidden;
            white-space:nowrap;
            text-overflow:ellipsis;
            width: 370pt;
        }

        .nowrap{
            white-space:nowrap;
        }
        /*.table td.noborder{*/
            /*border-top: 0px;*/
        /*}*/
        .table thead tr td{font-weight: bold; font-size: 11pt}

        h4{margin: 0px;  padding: 0px;font-size: 14pt}
        h5{
            font-size:11pt; font-family:'黑体'; font-weight: bold; margin: 0px;  padding: 0px;
        }
        div{font-size: 10pt}

        span.foot_sign{border-bottom: 1px solid #ddd}

        .table tbody tr td{border-top: 1px solid #ddd;}
        .table tbody tr:last-child td{padding: 0px}
        .table tbody tr.memo td {padding:0px; border-top:0px}

        td{font-size:10pt}

        .font-middle{
            font-size: 12pt;
        }


        .page_head{
            padding-bottom: 20px;
        }

        .underline{text-decoration: underline;}
    </style>
</head>
<body>
<div class="controls controls-row print-hide">
    <script>
        function LICENSES() {
            LODOP.SET_LICENSES("","CD9A14E608164F55F35D564059E8F43B","C94CEE276DB2187AE6B65D56B3FC2848","15F0BE661E7532B77491843CB2ED09AD");
        };


        function load_lodop(development){
            var script = document.createElement('script');
            var lodop_host = '{{lodop_host}}';
            if (development == 'development'){
                lodop_host = '127.0.0.1';
            }
            var result = false;
            script.onload = function(){
                 if ( !result && (!this.readyState || this.readyState == 'complete') ) {
                    result = true;
                    LICENSES();
                }
            }
            script.setAttribute('src', 'http://' + lodop_host + '/CLodopfuncs.js');
            // 把script标签加入head，此时调用开始
            document.getElementsByTagName('head')[0].appendChild(script);
            document.getElementById("btn-print0").className = "btn btn-primary";
            document.getElementById("btn-print0").innerHTML = "联单打印（备选）";
            document.getElementById("btn-print1").className = "btn btn-primary";
            document.getElementById("btn-print1").innerHTML = "A4纸打印（大办公室，单张）";
            document.getElementById("btn-print2").className = "btn btn-primary";
            document.getElementById("btn-print2").innerHTML = "A4纸打印（116办公室，自动2张）";
        }

        function check_print_ok(printer_index){

            if (LODOP.CVERSION) LODOP.On_Return = function(TaskID, Value){
                if (Value == '1'){
                    window.print_result_ok = true;
                    document.getElementById("btn-print" + printer_index).className = "btn btn-danger disabled";
                }
                else if (Value == '0'){
                    document.getElementById("btn-print" + printer_index).className = "btn btn-danger disabled";
                    window.print_result_ok = false
                }
                setTimeout(function(){
                    check_print_text(printer_index);
                }, 100)
            };
            var strResult = LODOP.GET_VALUE('PRINT_STATUS_OK', window.task_name);
        }

        function check_print_text(printer_index){
            if (LODOP.CVERSION) LODOP.On_Return = function(TaskID, Value){
                if (Value){
                    document.getElementById("btn-print" + printer_index).innerHTML = Value;
                    setTimeout(function(){
                        check_print_job_exists(printer_index);
                    }, 100)
                }
                else{
                    document.getElementById("btn-print" + printer_index).innerHTML = '没有';
                }

            };
            console.log('task_name:' + window.task_name);
            var strResult = LODOP.GET_VALUE('PRINT_STATUS_TEXT', window.task_name);
        }

        function check_print_job_exists(printer_index){
            if (LODOP.CVERSION) LODOP.On_Return = function(TaskID, Value){
                // 任务不存在
                if (Value == '0'){
                    //任务不存在并且打印成功, 则隐藏打印按钮
                    if (window.print_result_ok){
                        document.getElementById('btn-print' + printer_index).className = "btn btn-success disabled";
                        document.getElementById('btn-print' + printer_index).innerHTML = "打印成功";
                    }
                    //任务不存在并且打印不成功, 重新显示打印按钮
                    else {
                        document.getElementById('btn-print' + printer_index).innerHTML = "重新打印";
                        document.getElementById('btn-print' + printer_index).className = "btn btn-primary";
                    }
                }
                // 如果任务存在则继续检查打印结果
                else if (Value == '1'){
                    setTimeout(function(){
                        get_print_result();
                    }, 300)
                }
            };
            var strResult = LODOP.GET_VALUE('PRINT_STATUS_EXIST', window.task_name);
        }

        function get_print_result(printer_index){
            check_print_ok(printer_index);
        }

        function checkPrintResult(task_name, printer_index){
            console.log('task_name=' + window.task_name);
            window.task_name = task_name;
            setTimeout(function(){
                get_print_result(printer_index);
            }, 500)
        }

        function print_preview(printer_index){
            if (!LODOP.VERSION) return;
            LODOP.PRINT_INIT("东方团购中心订单{{order.name}}");
            LODOP.SET_PRINT_PAGESIZE(0, 2100, 2970, "2100x2970");

            var printer_count = LODOP.GET_PRINTER_COUNT();
            var intPrinterIndex = -1;
            for (var i = 0; i < printer_count; i ++){
                if (printer_index == '0'){
                    if(LODOP.GET_PRINTER_NAME(i).indexOf('东方团购中心联单订单') >= 0){
                        intPrinterIndex = i;
                        break;
                    }
                }
                else if (printer_index == '1'){
                    if(LODOP.GET_PRINTER_NAME(i).indexOf('东方团购中心订单') >= 0){
                        intPrinterIndex = i;
                        break;
                    }
                }
                else if (printer_index == '2'){
                    if(LODOP.GET_PRINTER_NAME(i).indexOf('东方团购中心116订单') >= 0){
                        intPrinterIndex = i;
                        break;
                    }
                }
            }
            if (intPrinterIndex == -1){
                alert('东方团购中心订单打印机不存在，无法打印');
                return;
            }
            //A4纸打印
            if (printer_index == '1' || printer_index == '2'){
                LODOP.SET_PRINT_COPIES(2); //出货单默认为2张
                CreateOneFormPage1();
            }
            //联单打印
            else{
                CreateOneFormPage0();
            }
            if (LODOP.SET_PRINTER_INDEXA(intPrinterIndex+'')){
                document.getElementById('btn-print' + printer_index).innerHTML = "正在打印";
                document.getElementById('btn-print' + printer_index).className = "btn btn-primary disabled";
                LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);
                if (LODOP.CVERSION) {
                    LODOP.On_Return = function (task_id, task_name) {
                        if (task_name){
                            checkPrintResult(task_name, printer_index);
                        }
                        else{
                            document.getElementById('btn-print' + printer_index).innerHTML = '错误:无法获取打印任务'
                        }
                    };
                    LODOP.PRINT();
                    return;
                }

            }
        }
        window.onload = function(){
            var xiaoxie = document.getElementById('spanGrandTotal').innerHTML;
            var daxie = cmycurd(xiaoxie);
            document.getElementById('spanGrandTotal').innerHTML = xiaoxie + " (" + daxie + ")";
            LICENSES();
        }

function CreateOneFormPage0(){
    var strStyle = "<style>" + document.getElementById("style").innerHTML + "</style>";
    LODOP.PRINT_INITA(0, 0, 800, 1200, "东方团购中心订单{{order.name}}");
    LODOP.SET_PRINT_PAGESIZE(0, 2100, 2970, "2100X2970");
    {#LODOP.ADD_PRINT_TEXT(18,676,120,15,"<?="第{$current_page}页/共" . ($page_count) . "页"?>");#}

    LODOP.ADD_PRINT_SETUP_BKIMG("<img border='0' src='http://crm.800890.com/dftg_lodop/static/src/img/sale_order_bg.jpg'>");
    LODOP.SET_SHOW_MODE("BKIMG_LEFT", 0);
    LODOP.SET_SHOW_MODE("BKIMG_TOP", 0);
    LODOP.SET_SHOW_MODE("BKIMG_WIDTH","220mm");//217+6/2
    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT","306mm");305+1.5/2
    LODOP.SET_SHOW_MODE("BKIMG_IN_PREVIEW", 1);
{% for order_line in order.order_line %}
  {% if loop.index0%10==0 %}
        LODOP.NewPage();
        {%  if is_vip %}
        LODOP.ADD_PRINT_TEXT(205,80,150,16,"VIP");
        {% endif %}
        LODOP.ADD_PRINT_TEXT(18,676,120,15,"第{{ loop.index//10+1 }}页/共{{order.order_line|length//10+1}} 页");
        LODOP.ADD_PRINT_TEXT(233,76,490,15,"{{order.partner_id.name|default(' ',True)}}");
        LODOP.SET_PRINT_STYLEA(0,"Horient",3);
        LODOP.ADD_PRINT_TEXT(229,525,146,20,"{{order.name|default(' ',True)}}");
        LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",14);
        //LODOP.ADD_PRINT_TEXT(261,100,100,15,"{{order.consignee|default(' ',True)}}"); 联系人不用打印
        //LODOP.ADD_PRINT_TEXT(263,281,248,14,"{{order.phone_number|default(' ',True)}}");
        {% if order.date_order %}
        LODOP.ADD_PRINT_TEXT(262,537,144,15,"{{order.date_order|strftime('%Y-%m-%d')|default(' ',True)}}");
        {% else %}
        {{ order.create_date|strftime('%Y-%m-%d') }}
        {% endif %}
        //LODOP.ADD_PRINT_TEXT(289,84,490,14,"{{order.street|default(' ',True)}}"); 地址不用打印
        LODOP.ADD_PRINT_TEXT(289,588,110,15,"{{order.expected_delivery_time|default(' ',True)}} {{order.expected_delivery_hour}}");
        {% if not options.priceHide %}
            LODOP.ADD_PRINT_TEXT(667,552,148,15,"{{order.amount_total}}");
            //卡券订单打印明细可能会覆盖金额大写，所以卡券订单不打印大写金额
            {% if not order.is_card %}
                {% if (order.amount_total|string|reverse)|length>=8 %}
                LODOP.ADD_PRINT_TEXT(666,100,22,15,"{{chinese[0]}}");
                {% endif %}
                {% if (order.amount_total|string|reverse)|length>=7 %}
                LODOP.ADD_PRINT_TEXT(666,147,21,15,"{{chinese[(order.amount_total|string|reverse)[7]]}}");
                {% endif %}
                {% if (order.amount_total|string|reverse)|length>=6 %}
                LODOP.ADD_PRINT_TEXT(666,195,20,15,"{{chinese[(order.amount_total|string|reverse)[6]]}}");
                {% endif %}
                {% if (order.amount_total|string|reverse)|length>=5%}
                LODOP.ADD_PRINT_TEXT(666,239,21,15,"{{chinese[(order.amount_total|string|reverse)[5]]}}");
                {% endif %}
                {% if (order.amount_total|string|reverse)|length>=4 %}
                LODOP.ADD_PRINT_TEXT(666,285,21,15,"{{chinese[(order.amount_total|string|reverse)[4]]}}");
                {% endif %}
                {% if (order.amount_total|string|reverse)|length>=3 %}
                LODOP.ADD_PRINT_TEXT(666,333,19,15,"{{chinese[(order.amount_total|string|reverse)[3]]}}");
                 {% endif %}
                LODOP.ADD_PRINT_TEXT(666,379,21,15,"{{chinese[(order.amount_total|string|reverse)[2]]}}");
                LODOP.ADD_PRINT_TEXT(667,424,21,14,"{{chinese[(order.amount_total|string|reverse)[0]]}}");
            {% endif %}
            //LODOP.ADD_PRINT_TEXT(695,66,187,44,"{{order.street|default('',True)}}");

            //LODOP.ADD_PRINT_TEXT(697,307,153,15,"{{order.consignee|default('',True)}}");
            //LODOP.ADD_PRINT_TEXT(698,557,147,15,"{{order.phone_number|default(' ',True)}} {{order.mobile_number|default(' ',True)}}");
            {% if order.payment_method=='现金' %}
            LODOP.ADD_PRINT_TEXT(752,212,18,15,"{{'√'|string}}");
            {% endif %}
            {% if order.payment_method=='支票' %}
            LODOP.ADD_PRINT_TEXT(752,357,18,15,"{{'√'|string}}");
            {% endif %}
            {% if order.payment_method=='转账' %}
            LODOP.ADD_PRINT_TEXT(752,508,18,15,"{{'√'|string}}");
            {% endif %}
        {% endif %}
        {% if official_invoice_outer_line %}
            LODOP.ADD_PRINT_TEXT(772,68,644,90,"{{official_invoice_outer_line|count}}张(W)"
            {% for invoice_line in official_invoice_outer_line %}
                + "\r\n台头:{{invoice_line.invoice_title|replace('\n', '\\r\\n')}} 金额:{{invoice_line.invoice_money}} 付款:{{invoice_line.pay_method}} 内容:{{invoice_line.invoice_content|replace('\n', '\\r\\n')}}"
            {% endfor %}
            );
        {% endif %}

        LODOP.ADD_PRINT_TEXT(809,64,644,208,"{{order.inner_note|default(' ',True)}} {{order.note|default(' ',True)|replace('\n', '\\r\\n')}}");
        LODOP.ADD_PRINT_TEXT(1054,83,100,20,"{{user_id_name|default(' ',True)}}");
    {% endif %}

    //产品名称已经包含了产品编号,所以不需要打印产品编号
	LODOP.ADD_PRINT_TEXT({{loop.index0 %10 * 275 / 9+360| round}},13,310,15,"{{[order_line.product_id.default_code]}} {{order_line.product_id.name|default(' ',True)}}");
	//LODOP.ADD_PRINT_TEXT({{loop.index0 %10 * 275 / 9+360| round}},129,189,15,"{{order_line.name|default(' ',True)}}");
	LODOP.ADD_PRINT_TEXT({{loop.index0 %10 * 275 / 9+360| round}},319,120,15,"{{order_line.product_id.prod_model|default(' ', True)}} {{order_line.prod_spec|default(' ', True)|replace('\n', '\\r\\n')}} {{order_line.sale_note|default(' ', True)|replace('\n', '\\r\\n')}}");
    	LODOP.ADD_PRINT_TEXT({{loop.index0 %10 * 275 / 9+360| round}},437,25,15,"{{order_line.product_uos.name|default(' ',True)}}");
    {% if not options.priceHide %}
	LODOP.ADD_PRINT_TEXT({{loop.index0 %10 * 275 / 9+360| round}},464,48,15,"{{order_line.price_unit|round(2)}}");
    {% endif %}
	LODOP.SET_PRINT_STYLEA(0,"Alignment",3);

	LODOP.ADD_PRINT_TEXT({{loop.index0 %10* 275 / 9+360| round}},513,61,15,"{{order_line.product_uom_qty|int}}");
	LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
    {% if not options.priceHide %}
	LODOP.ADD_PRINT_TEXT({{loop.index0 %10 * 275 / 9+360| round}},598,105,15,"{{order_line.price_subtotal|round(2)}}");
    {% endif %}
{% endfor %}
{% if order.is_card %}
    LODOP.ADD_PRINT_HTM(482, 20, "96%", 800, strStyle + document.getElementById("div-card-detail").innerHTML);
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
    LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);
    LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
    LODOP.SET_PRINT_STYLEA(0,"Horient",1);
{% endif %}
};


function CreateOneFormPage1(){
    var strStyle = "<style>" + document.getElementById("style").innerHTML + "</style>";
    LODOP.ADD_PRINT_TABLE(140,"1%","99%",414,strStyle+document.getElementById("div-body").innerHTML);
    LODOP.SET_PRINT_STYLEA(0,"Vorient",3);
    LODOP.SET_PRINT_STYLEA(0,"FontSize",8);

    LODOP.ADD_PRINT_HTM(20, 0,"60%",109,document.getElementById("div-title").innerHTML);
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
    LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);

    LODOP.ADD_PRINT_HTM(65,"5%","90%",109,document.getElementById("div-header").innerHTML);
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
    LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);

    LODOP.ADD_PRINT_HTM(564,"5%","90%",254,document.getElementById("div-note").innerHTML);
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
    LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);
    LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
    LODOP.SET_PRINT_STYLEA(0,"Horient",1);

    LODOP.ADD_PRINT_HTM(1070, 30, 450, 20,document.getElementById("div-foot").innerHTML);
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);

    LODOP.ADD_PRINT_HTM(1070, 500, 150,30,"<span tdata='pageNO' style='font-size:12px'>第##页</span>/<span tdata='pageCount'  style='font-size:12px'>共##页</span>");
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);


    LODOP.ADD_PRINT_BARCODE(2, 530, 230, 60, "Code93", "{% if order.real_so_id %}{{ order.real_so_id.name }}{% else %}{{ order.name }}{% endif%}");
    LODOP.ADD_PRINT_BARCODE(950, 630, 150, 150,"QRCode","{{url_prefix}}/wx/sale/order/{% if order.real_so_id %}{{ order.real_so_id.id }}{% else %}{{ order.id }}{% endif%}");

    LODOP.ADD_PRINT_TEXT(1078, 665, 150, 20,"微信扫码");
    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
    LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
};

    </script>
    {% if options.priceHide %}
        <a href="?options={&quot;priceHide&quot;:0}" class="btn btn-primary">显示价格</a>
    {% else %}
        <a href="?options={&quot;priceHide&quot;:1}" class="btn btn-primary">隐藏价格</a>
    {% endif %}
    <a id="btn-print1" href="javascript:print_preview('1')" class="btn btn-primary">A4纸打印（原大办公室）</a>
    <a id="btn-print2" href="javascript:print_preview('2')" class="btn btn-primary">A4纸打印（116办公室）</a>
    <a id="btn-print0" href="javascript:print_preview('0')" class="btn btn-primary">联单打印（备选）</a>

    注: 点击按钮打印A4纸订单，如需打印PDF电子稿，菜单上面选择文件->打印到，文件->页面设置里面可以去除页眉页脚
</div>


<div id="div-title">
    <table border="0" cellSpacing="0" cellPadding="0" width="100%">
        <tbody>
            <tr>
                <td align="center">
                    <h4 class="page_head">
                        {% if order.is_return %}
                            销售退货单
                        {% elif order.real_so_id %}
                            销售订单 {{order.name}}
                        {% else %}
                            {% if order.is_exchange %}
                                销售换货单
                            {% else %}
                                {% if order.state in ['draft','sent'] %}销售报价单{% else %}销售订单{% endif %}
                            {% endif %}
                        {% endif %}
                    </h4>
                </td>
            </tr>
    </tbody>
</table>
</div>
<div id="div-header">
    <table border="0" cellSpacing="0" cellPadding="0" width="100%" style="font-size:12px">
        <tbody>
            <tr>
                <td width="50%">客户:
                    {% if order.partner_id.is_company %}
                        {{ order.partner_id.name|default('', True) }}
                    {% else %}
                        {{ order.partner_id.name|default('', True) }}{{ order.partner_id.parent_id.name|default('', True) }}
                    {% endif %}
                    <!--联系人:-->
                    <!--，{{ order.consignee}}-->
                </td>
                <td width="25%" nowrap="nowrap">
                    下单日期: {{ order.date_order|default(order.create_date,True)|strftime('%Y-%m-%d') }}
                </td>
                <td><h4>
                    {% if order.is_return %}
                    计划退货:
                    {% else %}
                    计划发货:
                    {% endif %}
                    {{ order.expected_delivery_time }}</h4>
                </td>
            </tr>
            <tr>
                <td width="75%" colspan="2">地址:
                    {% if order.province_id and order.province_id.name != '上海市' %}
                    {{order.province_id.name}}
                    {% endif %}
                     &nbsp;
                    {% if order.city_id %}
                    {{order.city_id.city_name}}
                    {% endif %}
                     &nbsp;
                    {% if order.county_id %}
                    {{order.county_id.county_name}}
                    {% endif %}
                     &nbsp;
                        {% if order.street %}
                    {{order.street}}
                    {% endif %}

                    ，送货方式:
                    {% if order.shipping_type_sale == 'express_delivery' %}
                    快递
                    {% endif %}
                    {% if order.shipping_type_sale == 'sale_delivery' %}
                    销售送货
                    {% endif %}
                    {% if order.shipping_type_sale == 'self_logistics' %}
                    公司物流
                    {% endif %}
                    {% if order.shipping_type_sale == 'direct_delivery' %}
                    供应商直送
                    {% endif %}
                </td>
                <td>
                    {% if order.expected_delivery_time %}
                        具体时间: {{ order.expected_delivery_hour }}
                    {% else %}
                        未指定
                    {% endif %}
                </td>
            </tr>
        </tbody>
    </table>
</div>
<!--<div id="div-header">-->
    <!--<table border="0" cellSpacing="0" cellPadding="0" width="100%">-->
        <!--<tbody>-->
            <!--<tr>-->
                <!--<td colspan="3" align="center">-->
                    <!--<h4 class="page_head">{%  if is_vip %}-->
                        <!--VIP-->
                        <!--{% endif %}-->
                        <!--{% if order.is_return %}-->
                            <!--退货单-->
                        <!--{% else %}-->
                            <!--{% if order.is_exchange %}-->
                                <!--换货单-->
                            <!--{% else %}-->
                                <!--{% if order.state in ['draft','sent'] and not order.real_so_id %}报价单{% else %}销售订单{% endif %}-->
                            <!--{% endif %}-->
                        <!--{% endif %}-->
                    <!--</h4>-->
                <!--</td>-->
            <!--</tr>-->
            <!--<tr>-->
                <!--<td width="40%">客户:-->
                    <!--{% if order.partner_id.is_company %}-->
                        <!--{{ order.partner_id.name|default('', True) }}-->
                    <!--{% else %}-->
                        <!--{{ order.partner_id.parent_id.name|default('', True) }}-->
                    <!--{% endif %}-->

                <!--</td>-->
                <!--<td width="33%">联系人:-->
                     <!--&lt;!&ndash;{{ order.consignee}}&ndash;&gt;-->
                <!--</td>-->
                <!--{% if order.real_so_id %}-->
                <!--<td><h5>　 编号: {{ order.real_so_id.name }}</h5></td>-->
                <!--{% else %}-->
                 <!--<td><h5>　 编号: {{ order.name }}</h5></td>-->
                <!--{% endif%}-->
            <!--</tr>-->
            <!--<tr>-->
                <!--<td width="40%">地址:-->
                    <!--{{ order.city_id.city_name|default('', True) }}-->
                    <!--{{ order.county_id.county_name|default('', True) }}-->
                    <!--&lt;!&ndash;{{ order.street|default('', True) }}&ndash;&gt;-->
                    <!--{% if order.freight_type == 'freight_collect' %}-->
                    <!--(运费到付)-->
                    <!--{% endif %}-->
                    <!--{% if order.customer_pick_up %}-->
                    <!--(客户自提)-->
                    <!--{% endif %}-->
                <!--</td>-->
                <!--<td width="33%">&lt;!&ndash;-->
                    <!--手机: {{ order.partner_shipping_id.mobile|default('　　　　　　', True) }}-->
                    <!--电话: {{ order.partner_shipping_id.phone|default('　　　　　　', True) }}&ndash;&gt;-->
                <!--</td>-->
                <!--<td>　　下单日期: {% if order.date_order %}-->
                    <!--{{ order.date_order|strftime('%Y-%m-%d') }}-->
                    <!--{% else %}-->
                    <!--{{ order.create_date|strftime('%Y-%m-%d') }}-->
                    <!--{% endif %}-->
                <!--</td>-->
            <!--</tr>-->
            <!--<tr>-->
                <!--<td colspan="2">-->
                    <!--&lt;!&ndash;{% if order.zip %}&ndash;&gt;-->
                    <!--&lt;!&ndash;邮编:{{ order.zip|default('', True) }}&ndash;&gt;-->
                    <!--&lt;!&ndash;{% endif %}&ndash;&gt;-->
                <!--</td>-->
                <!--<td>-->
                    <!--{% if order.is_return %}-->
                    <!--预计退货时间:-->
                    <!--{% else %}-->
                    <!--预计发货时间:-->
                    <!--{% endif %}-->
                    <!--{% if order.expected_delivery_time %}-->
                        <!--{{ order.expected_delivery_time }} {{order.expected_delivery_hour}}-->
                    <!--{% else %}-->
                        <!--未指定-->
                    <!--{% endif %}-->
                <!--</td>-->
            <!--</tr>-->
        <!--</tbody>-->
    <!--</table>-->
<!--</div>-->


<div id="div-body">
    <table class="table table-striped" width="100%">
        <thead>
            <tr>
                <td width="15">#</td>
                <td>产品名称</td>
                <td class="nowrap">型号和备注</td>
                {% if not options.priceHide %}
                <td class="nowrap" style="text-align: right;">单价</td>
                {% endif %}
                <td class="nowrap" style="text-align: right;">数量</td>
                {% if not options.priceHide %}
                <td class="nowrap" style="text-align: right;">小计</td>
                {% endif %}
            </tr>
        </thead>
        <tbody>
            {% for line in order.order_line %}
            <tr>
                <td>{{loop.index}}</td>
                <td class="">
                        <span>[{{ line.product_id.default_code}}] {{line.product_id.name}}</span>
                </td>
                <td>{{line.product_id.prod_model|default(' ', True)}} {{line.prod_spec|default(' ', True)}} {{line.sale_note|default(' ', True)}}</td>
                {% if not options.priceHide %}
                <td style="text-align: right;">{{ line.price_unit }}</td>
                {% endif %}
                <td style="text-align: right;">{{ line.product_uom_qty|int() }} {% if line.product_uos %}({{ line.product_uos.name }}){% endif %}</td>
                {% if not options.priceHide %}
                <td style="text-align: right;">￥{{ line.price_unit * line.product_uom_qty }}</td>
                {% endif %}
            </tr>
            {% endfor %}
            <tr>
                <td></td>
                <td>
                </td>
                <td colspan="5" style="text-align: right;border-top: 1px solid #ddd;">
                    付款方式：[{{order.payment_method}}],　　　
                    {% if not options.priceHide %}
                    合计：￥<span id="spanGrandTotal">{{ order.amount_total }}</span>
                    {% endif %}
                </td>
            </tr>

            {% if official_invoice_outer_line %}
            <tr>
                <td width="80" style="background-color: white"></td>
                <td width="30" style="background-color: white">{{official_invoice_outer_line|count}}张(W)</td>
                <td>
                {% for invoice_line in official_invoice_outer_line %}
                    台头:{{invoice_line.invoice_title}}
                    金额:{{invoice_line.invoice_money}}
                    付款:{{invoice_line.pay_method}}
                    内容:{{invoice_line.invoice_content}}<br />
                {% endfor %}
                </td>
            </tr>
            {% endif %}

            {% if order.is_card %}
                <tr><td width="80" style="background-color: white">提货产品</td><td>
                <div id="div-card-detail">
				{% for order_card in order.sale_order_id %}
                    券号:{{order_card.starting_number.code}}{% if order_card.continue_number!=1 %}~{{order_card.ending_number}}({{order_card.continue_number}}张){% else %} ({{order_card.continue_number}}张){% endif %}<br />
				{% endfor %}
                {% for rel_product in order.sale_order_card_product_ids %}
                    {% if order.is_multiple_choice_one  %}
                        选项{{rel_product.suite}}:
                    {% endif %}
                    {{rel_product.product_id.default_code}} {{ rel_product.product_id.name_template }} × {{rel_product.product_qty|int}}<br />
                {% endfor %}
                </div>
                </td></tr>
            {% endif %}
        </tbody>
    </table>
</div>

<div id="div-note">
    <div class="memo" style="padding-left:15px;font-size:13px; font-weight: bold">
        {{order.note|default('', True)|replace('\n', '<br/>')|safe}}
    </div>
    <!--<div style="padding-top:10px;padding-left:15px;padding-bottom:20px;">-->
            <!--附加备注:__________________________________________________________-->
    <!--</div>-->
</div>

    <div style="float:right; margin-top:-20px">
        <img src="/wx/work/qr_or_bar_code?type=QR&width=100&value=sale/order/{% if order.real_so_id %}{{ order.real_so_id.id }}{% else %}{{ order.id }}{% endif%}" width="100" height="100" />
    </div>

<div id="div-foot">
    业务：<span class="foot_sign">{{ order.user_id.name|default("　　　　") }}　　</span>
    主管:<span class="foot_sign">　　　　</span>
    财务：<span class="foot_sign">　　　　</span>
    采购：<span class="foot_sign">　　　　</span>
</div>
<script src="http://{{lodop_host}}/jsonp_lodop.js"></script>
</body>
</html>
